select 
	* 
from(
	select 
		team,
		nvl(lag(year) over(partition by team order by year),0) as last_year, --上次夺冠的年份
		year,																--当前夺冠的年份
		nvl(lead(year) over(partition by team order by year),0) as next_year, --下次夺冠的年份
		year - nvl(lag(year) over(partition by team order by year),0) as diff_1,--当前夺冠的年份与上次夺冠的年份差的年数
		nvl(lead(year) over(partition by team order by year),0) -  year as diff_2 --下次夺冠的年份与当前夺冠的年份差的年数
	from t1
	)tmp
where diff_1 = 1 and diff_2 = 1; --只有当两次相差年数都是1年的时候，才是三连冠。

